#include<bits/stdc++.h>
using namespace std;

int main(){
    int n;
    cin>>n;
    vector<int> arr(n);
    for(int i = 0;i < n;i++){
        cin>>arr[i];
    }
    sort(arr.begin(),arr.end());
    arr[0] = 0;
    arr[n-1] = 0;
    double sum = 0;
    for(auto e : arr){
        sum += e;
    }
    // cout<<sum<<endl;
    // cout<<n-2<<endl;
    printf("%.2f",sum/(n-2));



    return 0;
}